We are pleased to announce the release of BoxLang 1.0.0-Beta 9! BoxLang Betas are released weekly. This is our ninth marker and we are incredibly excited as we are coming close to our stable release. We have some great news in this release!
What is BoxLang?
BoxLang is a modern dynamic JVM language that can be deployed on multiple runtimes: operating system (Windows/Mac/*nix/Embedded), web server, lambda, iOS, android, web assembly, and more. BoxLang combines many features from different programming languages, including Java, ColdFusion, Python, Ruby, Go, and PHP, to provide developers with a modern and expressive syntax.
It is also a drop-in replacement for Adobe ColdFusion and Lucee Engines.
How to get started?
Visit our docs at https://boxlang.ortusbooks.com and get coding today. If you want to try it out on the web then go to our online REPL at https://try.boxlang.io. You can also checkout our YouTube playlist: https://www.youtube.com/playlist?list=PLNE-ZbNnndB-40LvAbeSeT2Oi3V2gm_B8
Release Notes
Here are the latest release notes: https://boxlang.ortusbooks.com/readme/release-history/1.0.0-beta-9
New Features
BL-105 PDF Module
PDFs have landed for BoxLang. The full implementation for creating PDF documents is now complete and available via our bx-pdf
module. This module contributes the following Components to the language:
document
- the wrapping component for creating PDF documents- The following attributes are available to the
document
componentformat
- The format of the document to generate. This attribute is unused and will be removed in a future release as only PDF generation is supported. Any other format requested will throw an error.encryption
- The encryption level to use for the document. Default is none. Possible values are 128-bit, 40-bit, nonelocalUrl
- If true, the document will be generated with local URLs. Default is falsevariable
- The name of the variable to store the generated PDF binarybackgroundVisible
- If true, the background will be visible. Default is truebookmark
- If true, bookmarks will be generated. Default is truehtmlBookmark
- If true, it is possible to convert outlines to a list of named anchors (<a name="anchor_id">label</a>
) or a headings structure (<h1>... <h6>
). Transforming of HTML hyperlinks to PDF hyperlinks (if not explicitly disabled Hyperlink jumps within the same document are supported as wellorientation
- The orientation of the document. Default is portrait. Possible values are portrait, landscapescale
- The percentage to scale the document. Must be less than 100marginBottom
- The bottom margin of the documentmarginLeft
- The left margin of the documentmarginRight
- The right margin of the documentmarginTop
- The top margin of the documentpageWidth
- The width of the page in inchespageHeight
- The height of the page in inchesfontEmbed
- If true, fonts will be embedded in the document. Default is truefontDirectory
- The directory where fonts are locatedopenpassword
- The password to open protected documentsownerPassword
- The password to access restricted permissionspageType
- The type of page to generate. Default is A4.pdfa
- If true, the document will be generated as a PDF/A document. Default is falsefilename
- The filename to write the PDF to. If not provided and avariable
argument is not provided, the PDF will be written to the browser ( Web-context only )overwrite
- If true, the file will be overwritten if it exists. Default is falsesaveAsName
- The name to save the PDF as in the browsersrc
- A full URL or path relative to the web root of the sourcesrcfile
- The absolute path to a source filemimeType
- The mime type of the source. Default is text/html. Possible values are text/html, text/plain, application/xml, image/jpeg, image/png, image/bmp, image/gifunit
- The unit of measurement to use. Default is inches. Possible values are in, cm
- The following attributes are not currently implemented and will throw an error if used
permissions
- Granular permissability is not yet supportedpermissionspassword
- Granular permissability is not yet supporteduserPassword
- Granular permissability is not yet supportedauthPassword
- Granular permissability is not yet supportedauthUser
- Granular permissability is not yet supporteduserAgent
- HTTP user agent identifierproxyHost
- IP address or server name for proxy hostproxyPassword
- password for the proxy hostproxyPort
- port of the proxy hostproxyUser
- user name for the proxy hosttagged
- yes|no ACF OpenOffice integration not supportedformfields
- yes|no Form field attributes are not implemented in standard moduleformsType
- FDF|PDF|HTML|XML Form field attributes are not implemented in standard module
- The following attributes are available to the
documentitem
- specifies header, footer, and pagebreaks within a document body ordocumentsection
- The following attributes are available to the
documentitem
componenttype
A string which dictates the type of item. Accepted values arepagebreak
|header
|footer
evalAtPrint
This attribute is deprecated as all content is evaluated when the body of the tag is processed
- The following attributes are available to the
documentsection
- Divides a PDF document into sections. Used in conjunction with adocumentitem
component, each section can have unique headers, footers, and page numbers. A page break will always precede a section- The following attributes are available to the
documentsection
componentmarginBottom
- The bottom margin of the section in the unit specified in thedocument
component.marginLeft
- The left margin of the section in the unit specified in thedocument
component.marginRight
- The right margin of the section in the unit specified in thedocument
component.marginTop
- The top margin of the section in the unit specified in thedocument
component.mimeType
- The mime type of the content. If the content is a file, the mime type is determined by the file extension. If the content is a URL, the mime type is determined by the HTTP response.name
- The name of the section. This is used as a bookmark for the section.srcfile
- The absolute path of the file to include in the section.src
- The URL or path relative to the web root of the content to include in the section.
- The following attributes are not currently implemented and will throw an error if used
userAgent
- The HTTP user agent identifier to use when fetching the content from a URL.authPassword
- The authentication password to use when fetching the content from a URL.authUser
- The authentication user name to use when fetching the content from a URL.
- The following attributes are available to the
Examples
Simple example using tag-based syntax to generate a physical file:
<bx:set testImage = "https://ortus-public.s3.amazonaws.com/logos/ortus-medium.jpg"/>
<bx:document format="pdf" filename="/path/to/mydocument.pdf">
<!--- Header for all sections --->
<bx:documentitem type="header">
<h1>This is my Header</h1>
</bx:documentitem>
<!--- Footer for all sections --->
<bx:documentitem type="footer">
<h1>This is My Footer</h1>
<bx:output><p>Page #bxdocument.currentpagenumber# of #bxdocument.totalpages#</p></bx:output>
</bx:documentitem>
<!--- Document section, which will be bookmarked as "Section 1" --->
<bx:documentsection name="Section 1">
<h1>Section 1</h1>
</bx:documentsection>
<!--- Document section, which will be bookmarked as "Section 2" --->
<bx:documentsection name="Section 2">
<h1>Section 2</h1>
</bx:documentsection>
<!--- Document section, which contains an image --->
<bx:documentsection src="#testImage#">
</bx:document>
Example using script syntax to create a variable containing the binary contents of the PDF, which is then written to a file
document format="pdf" variable="myPDF"{
documentsection name="Section 1"{
writeOutput("<h1>Section 1</h1>");
include "/path/to/section1.bxm";
}
documentsection name="Section 2"{
writeOutput("<h1>Section 2</h1>");
include "/path/to/section2.bxm";
}
}
fileWrite( "/path/to/mydocument.pdf", myPDF );
BL-110 objectLoad() and objectSave() implemented and renamed to objectSerialize() and objectDeserialize()
This is a really step forward for BoxLang in providing the ability to serialize and deserialize any BoxLang type and any BoxLang class to binary recursively n-levels deep. We have introduced two BIFS to accomplish this:
objectSerialize( object, [filepath] ) : binary
objectDeserialize( input ) : object
You can pass ANY object
to the serialize function and it will recursively try to serialize the object to binary data. You can then store that in a database, cluster, cache, or a file using the filepath
argument. To deserialize you can use the objectDeserialize()
function and you can pass in the direct binary or a file path location for the binary.
The only requirement is that the object
be a BoxLang type or any Java type that implements serializable.
Also note that for CFML compatibility, the compat module will expose them as objectLoad()
and objectSave()
.
BL-420 Exit REPL with quit or exit
You can now exit the BoxLang REPL by typing quit
or exit
.
> quit
> exit
BL-422 Ability to serialize BoxLang classes to binary and deserialize them back using it's state
This was related to BL-110 but specifically to BoxLang classes. This allows us now to be able to take the state of any BoxLang class and be able to serialize it to binary. You can then deserialize the binary and inflate it back to a BoxLang object graph again.
BL-423 New experimental features block on the `boxlang.json`
The boxlang.json
get's a new top level configuration key: experimental
which will be a feature flags approach to turn on/off experimental features in BoxLang.
"experimental" : {
"flag1" : true|false
}
BL-424 BoxRunner action commands now for: compile, cftranspile, featureAudit
We have consolidated our CLI tooling to all funnel through the boxlang
binary script or boxlang.bat
for windows. You can now execute our CLI tools via action commands which is based on the following keys:
compile
- Executes the BoxLang compiler toolcftranspile
- Executes the CF to BoxLang transpile toolfeatureAudit
- Executes the feature audit tool
boxlang compile <options>
boxlang cftranspile <options>
boxlang featureAudit <options>
Improvements
BL-414 Renaming of Box Cache functions to standardized cache{function}()
The BoxLang Cache BIFs have been renamed to be standardized to the following:
cache( [provider:default] )
cacheFilter()
cacheNames()
cacheProviders()
cacheService()
BL-415 Increase precision of math operations by using BigDecimal
This introduces BigDecimal
usage all over BoxLang for two main use cases:
- Being able to store and process very large numbers that wouldn't fit inside a
Long
or aDouble
like111111111111111111111111111 + 222222222222222222222222222
- Being able to retain precision for decimals-- even small ones. For ex:
(0.1 + 0.2).toString()
outputs0.30000000000000004
in Lucee 5 and ACF 2023. But in Lucee 6 and BoxLang, it correctly returns.3
without any special work
Not ALL numbers are a BigDecimal
-- just the ones that need to be:
- integer literals in your source code less than 11 chars will be a java
Integer
- integer literals in your source code less than 20 chars will be a java
Long
- All other integer literals in your source will be a java
BigDecimal
- All decimal literals in your source will be a java
BigDecimal
Furthermore, we have added a new NumberCaster
which we should be using as our primary caster that returns an instance implementing the Number
interface in Java
- any recognizable classes like int, long, double, big decimal, etc are just returned directly
- Any strings which contain integers (no decimal or sci notation) follow the same rules above (integer for small ones, long for bigger ones, big decimal for really big ones)
- Any strings with a decimal or sci notation will be made a BigDecimal
Basically, we return the "Smallest" data type we can without losing any precision. (An Integer is about 24 Bytes and a BigDecimal is about 64 Bytes so it seemed worth optimizing a bit)
BL-421 Finalize FileUpload
, FileUploadAll
BIFs and File Component upload actions in Web Support
The web runtimes now have file uploading capabiltiies finalized.
Bugs
BL-405 BigIntegers cause error: integer number too large
BL-419 Not all unquoted tag attribute values are parsing
Add Your Comment